package com.cas.activemq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

@Component
@Scope("prototype")
public class QueueSender {

    private static final Logger logger = LoggerFactory.getLogger("data-access");
    /**
     * jmsMessagingTemplate
     */
    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplatePro;

    /**
     * @param queueNme 消息队列名
     * @param s        消息内容
     */
    public void SendMsg(String queueNme, String s) {
        this.jmsMessagingTemplatePro.convertAndSend(queueNme, s);
        logger.warn("[TcpServer]-<Send>->[ActiveMQ-(MQName:{})]-<Data>-[{}]", queueNme, s);
    }

}
